package com.baizhi.bzmall.admin.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OssConfig {
    @Value("${OSS.endpoint}")
    private String endpoint;
    @Bean
    public OSS getOssClient(){

        // 阿里云主账号AccessKey拥有所有API的访问权限，风险很高。强烈建议您创建并使用RAM账号进行API访问或日常运维，请登录RAM控制台创建RAM账号。
        String accessKeyId="LTAI5tJhqNPEuSmDoyBjxTgc";
        String accessKeySecret = "cU3nFHmTodpoVtIQcEUQPbNVOFUocP";

        OSS client = new OSSClientBuilder().build("https://"+endpoint, accessKeyId, accessKeySecret);
        return client;
    }
}
